<?php

namespace Database\Seeders;

use Carbon\Carbon;
use App\Models\GoldBean;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Log;

class ReturnClosedBeans extends Seeder
{
    public function run()
    {
    	GoldBean::where('remark', 'overtime_fine_beans')
		    ->whereDate('created_at', Carbon::today())
		    ->each(function (GoldBean $bean) {
		    	$beans = abs($bean->beans);
			    account_beans($bean->user)->plusPresentGoldBeans($beans);
			    Log::info("user: {$bean->user->id} beans: {$beans} returned.");
		    });
    }
}
